﻿using ETModel;

namespace ETHotfix {

    /// <summary>
    /// 系统级的热更层初始化需要的操作
    /// </summary>
    [ObjectSystem]
    public class HotfixComponentInit : AwakeSystem<HotfixComponent> {
        public override void Awake(HotfixComponent self) {
            if (StartConfigComponent.Instance.StartConfig.AppType.HasFlag(AppType.Map)) {
                Game.Scene.AddComponent<UnitsComponent>();
                Game.Scene.AddComponent<MapPlayersComponent>();
            }
            if (StartConfigComponent.Instance.StartConfig.AppType.HasFlag(AppType.Gate)) {
                Game.Scene.AddComponent<GatePlayersComponent>();
                Game.Scene.AddComponent<GatePlayerWaitReconnectComponent>();
            }
            if (StartConfigComponent.Instance.StartConfig.AppType.HasFlag(AppType.MapAudience)) {
                Game.Scene.AddComponent<AudClientsComponent>();
            }
        }
    }

}
